<!DOCTYPE html>
<html lang="en">

<head>
    <title>个人中心</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no" />
    <link href="../../css/public.css" rel="stylesheet">

    <style>
        .home_zhangdui_nav {
            overflow: hidden;
            background: url('../../images/reg/back.png') 10px center no-repeat;
            border-bottom: 1px solid #24254E;
            background-size: 0.7rem;
        }

        input::-webkit-input-placeholder,
        textarea::-webkit-input-placeholder {

            color: #505191;
        }

        input:-moz-placeholder,
        textarea:-moz-placeholder {

            color: #505191;
        }

        input::-moz-placeholder,
        textarea::-moz-placeholder {

            color: #505191;
        }

        input:-ms-input-placeholder,
        textarea:-ms-input-placeholder {

            color: #505191;
        }

        .card_contain input {
            display: block;
            background: #121459;
            width: 90%;
            height: 50PX;
            border: 0;
            box-sizing: border-box;
            padding-left: 10px;
            border-bottom: 1px solid #1B1D68;
            color: #eae3ff;
            margin: auto;
        }

        .card_contain .confirm {
            display: block;
            width: 90%;
            background: #FFDE83;
            /* 一些不支持背景渐变的浏览器 */
            background: -moz-linear-gradient(top, #FFDE83, #FFB300);
            background: -webkit-gradient(linear, 0 0, 0 bottom, from(#FFDE83), to( #FFB300));
            background: -o-linear-gradient(top, #FFDE83, #FFB300);
            border: 0;
            margin: auto;
            margin-top: 45px;
            height: 50PX;
            border-radius: 5px;
            font-size: .5rem;
            font-weight: 550;
            letter-spacing: 3px;
            line-height: 50px;
        }
    </style>
</head>

<body>

    <body>
        <div class="home_zhangdui_nav">
            <span class="goBack"></span>
            修改密码
        </div>

        <div class="card_contain">
            <input class="oldPd" type="password" name="password" placeholder="请输入旧密码">
            <input class="newPd" type="password" placeholder="请输入新密码(6-12位字母及数字)">
            <input class='confirmPd' type="password" placeholder="请再次输入新密码">
            <button class="confirm">确定</button>
        </div>

        <script src="../../js/jquery-3.2.1.min.js"></script>
        <script src="../../js/public.js"></script>
        <script>
            $(function () {
                let oldPwd,
                    newPwd,
                    confirmPwd


                $('.confirm').click(function(){
                    changePwd()
                })

                function changePwd() {
                    oldPwd = $('.oldPd').val()
                    newPwd = $('.newPd').val()
                    confirmPwd = $('.confirmPd').val()

                    if(oldPwd=='' || newPwd=='' ||confirmPwd==""){
                        alert('请输入正确的密码')
                    }
                   else{
                    $.post(passwordtUrl, {
                        oldPwd,
                        newPwd
                    }, (res) => {
                        if(res.code==0){
                            alert('修改成功')
                            window.location.href='./personal.html'
                        }
                        
                        else{
                            alert(res.msg)
                        }
                    })
                   }
                }
            })
        </script>
    </body>

</html>